Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default packed fields #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Droeftoeter
Copy link

This will set the default value for packed to true if the field is a repeated field with a numeric type.

@Droeftoeter
Copy link
Author

The tests don't reflect the change yet. I've read that the repeated numeric fields are only packed by default in proto3. Maybe we should check for that.

@FabioBatSilva
Copy link
Member

Hi @Droeftoeter,
Thanks for your contribution

Can you point me to docs on this ?

Also we should be able to check the proto version using this : https://github.com/protobuf-php/google-protobuf-proto/blob/master/src/descriptor.proto#L88

@Droeftoeter
Copy link
Author

@FabioBatSilva
Copy link
Member

Thanks for the PR @Droeftoeter,

A couple points that need to be addressed before we merge it.

  • We should check the PB version before defaulting it to [packed=true]
  • Also need o take care of writing the values
  • It might be easier to wrap/modify FieldDescriptorProto#options and default packed to true when using proto3

@Droeftoeter
Copy link
Author

I agree, I will update the PR soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants